package com.ddd.mill.domain.aggregate.constant.user.constant;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;

/**
 * @description:
 * @author: zhushaode
 * @date: 2020-11-18 10:33
 */
@Getter
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum UserAuthStatusEnum {

    NO_AUTH(0,"未认证"),
    AUTH(1,"已认证");

    @EnumValue
    private final Integer value;
    private final String desc;

    UserAuthStatusEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }
    @JsonCreator
    public static UserAuthStatusEnum get(Integer value){
        for (UserAuthStatusEnum e : UserAuthStatusEnum.values()) {
            if (e.getValue().equals(value)) {
                return e;
            }
        }
        return null;
    }
}
